package org.jackysoft.ztree;

import java.util.ArrayList;
import java.util.Collection;

import org.jackysoft.entity.User;
import org.jackysoft.util.CollectionUtils;

public class OnlineUserZtreeFunction extends UserZtreeFunction {

	private Collection<User> onlines;
	
	
	public OnlineUserZtreeFunction(Collection<User> onlines) {
		super();
		this.onlines = CollectionUtils.isEmpty(onlines)?new ArrayList<User>():onlines;
		
	}


	@Override
	public ZTreeNode apply(User arg0) {
		ZTreeNode node = super.apply(arg0);
		if(onlines.contains(arg0))
			node.setIcon("images/online.png");		
		return node;
	}

}
